package ru.lenwp.operation.admin;

import ru.lenwp.context.Context;
import ru.lenwp.model.OperationInfo;
import ru.lenwp.model.User;
import ru.lenwp.operation.Operation;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

/**
 * Created by Lenar on 26.06.2014.
 */
public class OperationAdmin implements Operation {

    Context context;

    @Override
    public OperationInfo execute() {
        getOperationName();
        return null;
    }

    @Override
    public String getOperationName() {
        List<String> operationName = new LinkedList<String>();
        operationName.add(allOperationAdmin());
        String res = null;
        Iterator<String> iterator = operationName.iterator();
        while (iterator.hasNext()){
            res = iterator.next();
        }
        return res;
    }

    private String allOperationAdmin(){
        String[] arr = {
                        new CreateNewUserOperation(context).getOperationName(),
                        new SaveUsersOperation(context).getOperationName(),
                        new LoadUsersOperation(context).getOperationName(),
                        new EditUserOperation(context).getOperationName(),
                        new EditPasswordOperation(context).getOperationName(),
                        };
        String res = null;
        for(int i=0; i<arr.length; i++) {
            res = arr[i];
        }
        return res;
    }
}
